public class Test {
    public boolean chkPalindrome() {
        if(head == null) {
            return true;
        }
        if(head.next == null) {
            return true;
        }


        ListNode slow = head;
        ListNode fast = head;

        while(fast.next != null) {
            fast = fast.next.next;
            slow = slow.next;
        }

        while(cur != null) {
            ListNode curN = cur.next;
            cur.next = slow;
            slow = cur;
            cur = curN;
        }

        while(head.next != slow.next ) {
            if(head.val == slow.val ) {
                head = head.next;
                slow = slow.next;
            }else {
                return false;
            }
            return true;
        }
    }


    public MySingleList.ListNode getIntersectionNode(MySingleList.ListNode headA,
                                                     MySingleList.ListNode headB) {

//1. 假定 A链表长  B链表短
        MySingleList.ListNode pl = headA;
        MySingleList.ListNode ps = headB;

//2.分别求两个链表的长度
        int lenA = 0;
        LisiNode curA = head;
        while(curA != null) {
            lenA++;
        }

        int lenB = 0;
        LisiNode curB = head;
        while(curB != null) {
            lenB++;
        }
//3. 求长度的差值 len
        int len = lenA - lenB;

        ListNode Pl = headA;
        ListNode Ps = headB;
//len < 0   -->  pl = headB  ps = headA len = len2 - len1

        if(len < 0) {
            len = lenB - lenA;
            pl = headB;
            pS = lenA;
        }
//4. 确定 pl指向的节点 一定是长链表  ps指向的节点 一定是短链表
//5.让pl走 len步

        while(len != 0) {
            pl = pl.next;
            len--;
        }
//6. ps 和 pl 同时走 直到相遇
        while( pl != ps) {
            pl = pl.next;
            ps = ps.next;
        }
        return pl;
    }
}
